package cn.edu.bcu.ls.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.edu.bcu.ls.entity.Course;
import cn.edu.bcu.ls.entity.Put;
import cn.edu.bcu.ls.entity.Section;
import cn.edu.bcu.ls.entity.SectionParams;
import cn.edu.bcu.ls.entity.User;
import cn.edu.bcu.ls.entity.Work;
import cn.edu.bcu.ls.entity.WorkParams;
import cn.edu.bcu.ls.serviceImpl.PutService;
import cn.edu.bcu.ls.serviceImpl.WorkService;
import io.swagger.annotations.ApiOperation;

@RestController
public class WorkController {
	@Autowired
	private WorkService workService;
	private PutService putService;
	
	@ApiOperation(value = "上传作业，传入你想要的传的值就行")
	@PostMapping(value="Work")
	public boolean insertUser(Work work) {
		if (workService.insertSelective(work) >0) {
			return true;
		}else {
			return false;
		}
	}
	
	@ApiOperation(value="修改作业，传入id和想修改的值")
	@PutMapping(value="Work")
	public boolean updateWork(Work work) {
		if (workService.updateByPrimaryKeySelective(work) >0) {
			return true;
		}else {
			return false;
		}
	}
	
	@ApiOperation(value = "根据cId,wId（可以不传）查询作业")
	@GetMapping(value="WorkParams")
	public List selectByPrimaryKey(WorkParams workParams) {
		List<Course> courses = workService.selectBycIdwId(workParams);
		System.out.print(courses);
		return courses;
	}
	
	
	
}
